package com.example.express;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.widget.TextView;

import com.example.express.base.BaseActivity;

public class AgreementActivity extends BaseActivity {

    private static String title="";
    private Spanned spanned;

    public static void start(Context context, String title){
        AgreementActivity.title =title;
        context.startActivity(new Intent(context,AgreementActivity.class));
    }
    @Override
    protected int initLayout() {
        return R.layout.activity_agreement;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        TextView tvAgreement = findViewById(R.id.tv_agreement);
        TextView tvTitle = findViewById(R.id.tv_title);
        TextView tvBack = findViewById(R.id.tv_back);
        if(!title.equals("用户协议")){
            spanned = Html.fromHtml(getResources()
                    .getString(R.string.privacy_policy));
        }else {
            spanned = Html.fromHtml(getResources()
                    .getString(R.string.user_agreement));
        }
        tvAgreement.setText(spanned);
        tvTitle.setText(title);
        tvBack.setOnClickListener(v -> finish());
    }
}